.class public Lcom/netease/util/PicUtils;
.super Ljava/lang/Object;
.source "PicUtils.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/netease/util/PicUtils$FlushedInputStream;
    }
.end annotation


# static fields
.field private static final TAG:Ljava/lang/String; = "PicUtil"


# direct methods
.method public constructor <init>()V
    .locals 0

    .prologue
    .line 30
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method public static composeSize(II)Ljava/lang/String;
    .locals 4
    .parameter "width"
    .parameter "height"

    .prologue
    .line 376
    const-string v0, "%dx%d"

    const/4 v1, 0x2

    new-array v1, v1, [Ljava/lang/Object;

    const/4 v2, 0x0

    invoke-static {p0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v3

    aput-object v3, v1, v2

    const/4 v2, 0x1

    invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v3

    aput-object v3, v1, v2

    invoke-static {v0, v1}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public static composeSizeFromDimen(Landroid/content/Context;II)Ljava/lang/String;
    .locals 3
    .parameter "context"
    .parameter "widthResId"
    .parameter "heightResId"

    .prologue
    .line 363
    invoke-virtual {p0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v2

    invoke-virtual {v2, p1}, Landroid/content/res/Resources;->getDimension(I)F

    move-result v2

    float-to-int v1, v2

    .line 364
    .local v1, width:I
    invoke-virtual {p0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v2

    invoke-virtual {v2, p2}, Landroid/content/res/Resources;->getDimension(I)F

    move-result v2

    float-to-int v0, v2

    .line 365
    .local v0, height:I
    invoke-static {v1, v0}, Lcom/netease/util/PicUtils;->composeSize(II)Ljava/lang/String;

    move-result-object v2

    return-object v2
.end method

.method private static getBimatCompressFormat(Ljava/lang/String;)Landroid/graphics/Bitmap$CompressFormat;
    .locals 1
    .parameter "name"

    .prologue
    .line 447
    sget-object v0, Landroid/graphics/Bitmap$CompressFormat;->PNG:Landroid/graphics/Bitmap$CompressFormat;

    return-object v0
.end method

.method public static getReadBitmapOptions()Landroid/graphics/BitmapFactory$Options;
    .locals 3

    .prologue
    const/4 v2, 0x1

    .line 410
    new-instance v0, Landroid/graphics/BitmapFactory$Options;

    invoke-direct {v0}, Landroid/graphics/BitmapFactory$Options;-><init>()V

    .line 411
    .local v0, opt:Landroid/graphics/BitmapFactory$Options;
    sget-object v1, Landroid/graphics/Bitmap$Config;->RGB_565:Landroid/graphics/Bitmap$Config;

    iput-object v1, v0, Landroid/graphics/BitmapFactory$Options;->inPreferredConfig:Landroid/graphics/Bitmap$Config;

    .line 412
    iput-boolean v2, v0, Landroid/graphics/BitmapFactory$Options;->inPurgeable:Z

    .line 413
    iput-boolean v2, v0, Landroid/graphics/BitmapFactory$Options;->inInputShareable:Z

    .line 414
    return-object v0
.end method

.method public static getWriteBitmapOptions()Landroid/graphics/BitmapFactory$Options;
    .locals 3

    .prologue
    const/4 v2, 0x1

    .line 425
    new-instance v0, Landroid/graphics/BitmapFactory$Options;

    invoke-direct {v0}, Landroid/graphics/BitmapFactory$Options;-><init>()V

    .line 426
    .local v0, opt:Landroid/graphics/BitmapFactory$Options;
    sget-object v1, Landroid/graphics/Bitmap$Config;->RGB_565:Landroid/graphics/Bitmap$Config;

    iput-object v1, v0, Landroid/graphics/BitmapFactory$Options;->inPreferredConfig:Landroid/graphics/Bitmap$Config;

    .line 427
    iput-boolean v2, v0, Landroid/graphics/BitmapFactory$Options;->inPurgeable:Z

    .line 428
    iput-boolean v2, v0, Landroid/graphics/BitmapFactory$Options;->inInputShareable:Z

    .line 429
    return-object v0
.end method

.method public static parseSize(Ljava/lang/String;)[I
    .locals 5
    .parameter "size"

    .prologue
    const/4 v4, 0x2

    .line 387
    :try_start_0
    invoke-static {p0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v3

    if-nez v3, :cond_0

    .line 388
    const-string v3, "x"

    invoke-virtual {p0, v3}, Ljava/lang/String;->split(Ljava/lang/String;)[Ljava/lang/String;

    move-result-object v1

    .line 389
    .local v1, strs:[Ljava/lang/String;
    if-eqz v1, :cond_0

    array-length v3, v1

    if-ne v3, v4, :cond_0

    .line 390
    const/4 v3, 0x0

    aget-object v3, v1, v3

    invoke-static {v3}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I

    move-result v2

    .line 391
    .local v2, w:I
    const/4 v3, 0x1

    aget-object v3, v1, v3

    invoke-static {v3}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I

    move-result v0

    .line 392
    .local v0, h:I
    const/4 v3, 0x2

    new-array v3, v3, [I

    const/4 v4, 0x0

    .line 393
    aput v2, v3, v4

    const/4 v4, 0x1

    aput v0, v3, v4
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 399
    .end local v0           #h:I
    .end local v1           #strs:[Ljava/lang/String;
    .end local v2           #w:I
    :goto_0
    return-object v3

    .line 397
    :catch_0
    move-exception v3

    .line 399
    :cond_0
    const/4 v3, 0x0

    goto :goto_0
.end method

.method public static readBitmap(Landroid/content/res/Resources;Ljava/io/File;Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;
    .locals 5
    .parameter "res"
    .parameter "file"
    .parameter "options"

    .prologue
    .line 85
    const/4 v1, 0x0

    .line 87
    .local v1, is:Ljava/io/InputStream;
    :try_start_0
    new-instance v2, Ljava/io/FileInputStream;

    invoke-direct {v2, p1}, Ljava/io/FileInputStream;-><init>(Ljava/io/File;)V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0
    .catch Ljava/io/FileNotFoundException; {:try_start_0 .. :try_end_0} :catch_1

    .line 88
    .end local v1           #is:Ljava/io/InputStream;
    .local v2, is:Ljava/io/InputStream;
    :try_start_1
    invoke-static {p0, v2, p2}, Lcom/netease/util/PicUtils;->readBitmap(Landroid/content/res/Resources;Ljava/io/InputStream;Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_1
    .catch Ljava/io/FileNotFoundException; {:try_start_1 .. :try_end_1} :catch_4

    move-result-object v3

    .line 92
    if-eqz v2, :cond_0

    .line 94
    :try_start_2
    invoke-virtual {v2}, Ljava/io/InputStream;->close()V
    :try_end_2
    .catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_0

    :cond_0
    :goto_0
    move-object v1, v2

    .line 100
    .end local v2           #is:Ljava/io/InputStream;
    .restart local v1       #is:Ljava/io/InputStream;
    :goto_1
    return-object v3

    .line 95
    .end local v1           #is:Ljava/io/InputStream;
    .restart local v2       #is:Ljava/io/InputStream;
    :catch_0
    move-exception v0

    .line 96
    .local v0, e:Ljava/io/IOException;
    invoke-virtual {v0}, Ljava/io/IOException;->printStackTrace()V

    goto :goto_0

    .line 89
    .end local v0           #e:Ljava/io/IOException;
    .end local v2           #is:Ljava/io/InputStream;
    .restart local v1       #is:Ljava/io/InputStream;
    :catch_1
    move-exception v0

    .line 90
    .local v0, e:Ljava/io/FileNotFoundException;
    :goto_2
    :try_start_3
    const-string v3, "PicUtil"

    const-string v4, "readDrawalbe error!!!!!"

    invoke-static {v3, v4, v0}, Lcom/netease/util/Logger;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V
    :try_end_3
    .catchall {:try_start_3 .. :try_end_3} :catchall_0

    .line 92
    if-eqz v1, :cond_1

    .line 94
    :try_start_4
    invoke-virtual {v1}, Ljava/io/InputStream;->close()V
    :try_end_4
    .catch Ljava/io/IOException; {:try_start_4 .. :try_end_4} :catch_2

    .line 100
    .end local v0           #e:Ljava/io/FileNotFoundException;
    :cond_1
    :goto_3
    const/4 v3, 0x0

    goto :goto_1

    .line 95
    .restart local v0       #e:Ljava/io/FileNotFoundException;
    :catch_2
    move-exception v0

    .line 96
    .local v0, e:Ljava/io/IOException;
    invoke-virtual {v0}, Ljava/io/IOException;->printStackTrace()V

    goto :goto_3

    .line 91
    .end local v0           #e:Ljava/io/IOException;
    :catchall_0
    move-exception v3

    .line 92
    :goto_4
    if-eqz v1, :cond_2

    .line 94
    :try_start_5
    invoke-virtual {v1}, Ljava/io/InputStream;->close()V
    :try_end_5
    .catch Ljava/io/IOException; {:try_start_5 .. :try_end_5} :catch_3

    .line 99
    :cond_2
    :goto_5
    throw v3

    .line 95
    :catch_3
    move-exception v0

    .line 96
    .restart local v0       #e:Ljava/io/IOException;
    invoke-virtual {v0}, Ljava/io/IOException;->printStackTrace()V

    goto :goto_5

    .line 91
    .end local v0           #e:Ljava/io/IOException;
    .end local v1           #is:Ljava/io/InputStream;
    .restart local v2       #is:Ljava/io/InputStream;
    :catchall_1
    move-exception v3

    move-object v1, v2

    .end local v2           #is:Ljava/io/InputStream;
    .restart local v1       #is:Ljava/io/InputStream;
    goto :goto_4

    .line 89
    .end local v1           #is:Ljava/io/InputStream;
    .restart local v2       #is:Ljava/io/InputStream;
    :catch_4
    move-exception v0

    move-object v1, v2

    .end local v2           #is:Ljava/io/InputStream;
    .restart local v1       #is:Ljava/io/InputStream;
    goto :goto_2
.end method

.method public static readBitmap(Landroid/content/res/Resources;Ljava/io/InputStream;Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;
    .locals 4
    .parameter "res"
    .parameter "is"
    .parameter "options"

    .prologue
    .line 139
    const/4 v0, 0x0

    .line 141
    .local v0, bIs:Ljava/io/BufferedInputStream;
    :try_start_0
    new-instance v1, Ljava/io/BufferedInputStream;

    new-instance v2, Lcom/netease/util/PicUtils$FlushedInputStream;

    invoke-direct {v2, p1}, Lcom/netease/util/PicUtils$FlushedInputStream;-><init>(Ljava/io/InputStream;)V

    invoke-direct {v1, v2}, Ljava/io/BufferedInputStream;-><init>(Ljava/io/InputStream;)V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 142
    .end local v0           #bIs:Ljava/io/BufferedInputStream;
    .local v1, bIs:Ljava/io/BufferedInputStream;
    :try_start_1
    invoke-static {p1}, Landroid/graphics/BitmapFactory;->decodeStream(Ljava/io/InputStream;)Landroid/graphics/Bitmap;
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_1

    move-result-object v2

    .line 146
    if-eqz v1, :cond_0

    .line 148
    :try_start_2
    invoke-virtual {v1}, Ljava/io/BufferedInputStream;->close()V
    :try_end_2
    .catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_0

    .line 142
    :cond_0
    :goto_0
    return-object v2

    .line 145
    .end local v1           #bIs:Ljava/io/BufferedInputStream;
    .restart local v0       #bIs:Ljava/io/BufferedInputStream;
    :catchall_0
    move-exception v2

    .line 146
    :goto_1
    if-eqz v0, :cond_1

    .line 148
    :try_start_3
    invoke-virtual {v0}, Ljava/io/BufferedInputStream;->close()V
    :try_end_3
    .catch Ljava/io/IOException; {:try_start_3 .. :try_end_3} :catch_1

    .line 152
    :cond_1
    :goto_2
    throw v2

    .line 149
    .end local v0           #bIs:Ljava/io/BufferedInputStream;
    .restart local v1       #bIs:Ljava/io/BufferedInputStream;
    :catch_0
    move-exception v3

    goto :goto_0

    .end local v1           #bIs:Ljava/io/BufferedInputStream;
    .restart local v0       #bIs:Ljava/io/BufferedInputStream;
    :catch_1
    move-exception v3

    goto :goto_2

    .line 145
    .end local v0           #bIs:Ljava/io/BufferedInputStream;
    .restart local v1       #bIs:Ljava/io/BufferedInputStream;
    :catchall_1
    move-exception v2

    move-object v0, v1

    .end local v1           #bIs:Ljava/io/BufferedInputStream;
    .restart local v0       #bIs:Ljava/io/BufferedInputStream;
    goto :goto_1
.end method

.method public static readBitmap(Landroid/content/res/Resources;Ljava/lang/String;Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;
    .locals 5
    .parameter "res"
    .parameter "path"
    .parameter "options"

    .prologue
    .line 111
    const/4 v1, 0x0

    .line 113
    .local v1, is:Ljava/io/InputStream;
    :try_start_0
    new-instance v2, Ljava/io/FileInputStream;

    invoke-direct {v2, p1}, Ljava/io/FileInputStream;-><init>(Ljava/lang/String;)V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0
    .catch Ljava/io/FileNotFoundException; {:try_start_0 .. :try_end_0} :catch_1

    .line 114
    .end local v1           #is:Ljava/io/InputStream;
    .local v2, is:Ljava/io/InputStream;
    :try_start_1
    invoke-static {p0, v2, p2}, Lcom/netease/util/PicUtils;->readBitmap(Landroid/content/res/Resources;Ljava/io/InputStream;Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_1
    .catch Ljava/io/FileNotFoundException; {:try_start_1 .. :try_end_1} :catch_4

    move-result-object v3

    .line 118
    if-eqz v2, :cond_0

    .line 120
    :try_start_2
    invoke-virtual {v2}, Ljava/io/InputStream;->close()V
    :try_end_2
    .catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_0

    :cond_0
    :goto_0
    move-object v1, v2

    .line 126
    .end local v2           #is:Ljava/io/InputStream;
    .restart local v1       #is:Ljava/io/InputStream;
    :goto_1
    return-object v3

    .line 121
    .end local v1           #is:Ljava/io/InputStream;
    .restart local v2       #is:Ljava/io/InputStream;
    :catch_0
    move-exception v0

    .line 122
    .local v0, e:Ljava/io/IOException;
    invoke-virtual {v0}, Ljava/io/IOException;->printStackTrace()V

    goto :goto_0

    .line 115
    .end local v0           #e:Ljava/io/IOException;
    .end local v2           #is:Ljava/io/InputStream;
    .restart local v1       #is:Ljava/io/InputStream;
    :catch_1
    move-exception v0

    .line 116
    .local v0, e:Ljava/io/FileNotFoundException;
    :goto_2
    :try_start_3
    const-string v3, "PicUtil"

    const-string v4, "readDrawalbe error!!!!!"

    invoke-static {v3, v4, v0}, Lcom/netease/util/Logger;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V
    :try_end_3
    .catchall {:try_start_3 .. :try_end_3} :catchall_0

    .line 118
    if-eqz v1, :cond_1

    .line 120
    :try_start_4
    invoke-virtual {v1}, Ljava/io/InputStream;->close()V
    :try_end_4
    .catch Ljava/io/IOException; {:try_start_4 .. :try_end_4} :catch_2

    .line 126
    .end local v0           #e:Ljava/io/FileNotFoundException;
    :cond_1
    :goto_3
    const/4 v3, 0x0

    goto :goto_1

    .line 121
    .restart local v0       #e:Ljava/io/FileNotFoundException;
    :catch_2
    move-exception v0

    .line 122
    .local v0, e:Ljava/io/IOException;
    invoke-virtual {v0}, Ljava/io/IOException;->printStackTrace()V

    goto :goto_3

    .line 117
    .end local v0           #e:Ljava/io/IOException;
    :catchall_0
    move-exception v3

    .line 118
    :goto_4
    if-eqz v1, :cond_2

    .line 120
    :try_start_5
    invoke-virtual {v1}, Ljava/io/InputStream;->close()V
    :try_end_5
    .catch Ljava/io/IOException; {:try_start_5 .. :try_end_5} :catch_3

    .line 125
    :cond_2
    :goto_5
    throw v3

    .line 121
    :catch_3
    move-exception v0

    .line 122
    .restart local v0       #e:Ljava/io/IOException;
    invoke-virtual {v0}, Ljava/io/IOException;->printStackTrace()V

    goto :goto_5

    .line 117
    .end local v0           #e:Ljava/io/IOException;
    .end local v1           #is:Ljava/io/InputStream;
    .restart local v2       #is:Ljava/io/InputStream;
    :catchall_1
    move-exception v3

    move-object v1, v2

    .end local v2           #is:Ljava/io/InputStream;
    .restart local v1       #is:Ljava/io/InputStream;
    goto :goto_4

    .line 115
    .end local v1           #is:Ljava/io/InputStream;
    .restart local v2       #is:Ljava/io/InputStream;
    :catch_4
    move-exception v0

    move-object v1, v2

    .end local v2           #is:Ljava/io/InputStream;
    .restart local v1       #is:Ljava/io/InputStream;
    goto :goto_2
.end method

.method public static readFileImage(Ljava/lang/String;)[B
    .locals 6
    .parameter "filename"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 161
    new-instance v0, Ljava/io/BufferedInputStream;

    .line 162
    new-instance v4, Ljava/io/FileInputStream;

    invoke-direct {v4, p0}, Ljava/io/FileInputStream;-><init>(Ljava/lang/String;)V

    .line 161
    invoke-direct {v0, v4}, Ljava/io/BufferedInputStream;-><init>(Ljava/io/InputStream;)V

    .line 163
    .local v0, bufferedInputStream:Ljava/io/BufferedInputStream;
    invoke-virtual {v0}, Ljava/io/BufferedInputStream;->available()I

    move-result v2

    .line 164
    .local v2, len:I
    new-array v1, v2, [B

    .line 165
    .local v1, bytes:[B
    invoke-virtual {v0, v1}, Ljava/io/BufferedInputStream;->read([B)I

    move-result v3

    .line 166
    .local v3, r:I
    if-eq v2, v3, :cond_0

    .line 167
    const/4 v1, 0x0

    check-cast v1, [B

    .line 168
    new-instance v4, Ljava/io/IOException;

    const-string v5, "\u8bfb\u53d6\u6587\u4ef6\u4e0d\u6b63\u786e"

    invoke-direct {v4, v5}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw v4

    .line 170
    :cond_0
    invoke-virtual {v0}, Ljava/io/BufferedInputStream;->close()V

    .line 171
    return-object v1
.end method

.method public static resizePic(Landroid/graphics/Bitmap;IIZZ)Landroid/graphics/Bitmap;
    .locals 17
    .parameter "src"
    .parameter "width"
    .parameter "height"
    .parameter "resized"
    .parameter "scaled"

    .prologue
    .line 288
    const/4 v10, 0x0

    .line 290
    .local v10, bitmap:Landroid/graphics/Bitmap;
    if-eqz p0, :cond_0

    if-eqz p1, :cond_0

    if-nez p2, :cond_2

    .line 291
    :cond_0
    const-string v3, "PicUtil"

    new-instance v9, Ljava/lang/StringBuilder;

    const-string v16, "resizePic error!!! "

    move-object/from16 v0, v16

    invoke-direct {v9, v0}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    move-object/from16 v0, p0

    invoke-virtual {v9, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v9

    const-string v16, ",width="

    move-object/from16 v0, v16

    invoke-virtual {v9, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v9

    move/from16 v0, p1

    invoke-virtual {v9, v0}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v9

    const-string v16, ",height="

    move-object/from16 v0, v16

    invoke-virtual {v9, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v9

    move/from16 v0, p2

    invoke-virtual {v9, v0}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v9

    invoke-virtual {v9}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v9

    invoke-static {v3, v9}, Lcom/netease/util/Logger;->e(Ljava/lang/String;Ljava/lang/String;)V

    .line 292
    if-eqz p0, :cond_1

    .line 293
    invoke-virtual/range {p0 .. p0}, Landroid/graphics/Bitmap;->recycle()V

    .line 295
    :cond_1
    const/4 v3, 0x0

    .line 351
    :goto_0
    return-object v3

    .line 299
    :cond_2
    :try_start_0
    invoke-virtual/range {p0 .. p0}, Landroid/graphics/Bitmap;->getWidth()I

    move-result v15

    .line 300
    .local v15, srcW:I
    invoke-virtual/range {p0 .. p0}, Landroid/graphics/Bitmap;->getHeight()I
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    move-result v14

    .line 301
    .local v14, srcH:I
    int-to-float v3, v15

    move/from16 v0, p1

    int-to-float v9, v0

    div-float v13, v3, v9

    .line 302
    .local v13, sW:F
    int-to-float v3, v14

    move/from16 v0, p2

    int-to-float v9, v0

    div-float v12, v3, v9

    .line 303
    .local v12, sH:F
    const/high16 v3, 0x3f80

    cmpl-float v3, v13, v3

    if-nez v3, :cond_4

    const/high16 v3, 0x3f80

    cmpl-float v3, v12, v3

    if-nez v3, :cond_4

    .line 305
    move-object/from16 v10, p0

    .line 346
    :goto_1
    if-eqz p0, :cond_3

    move-object/from16 v0, p0

    if-eq v0, v10, :cond_3

    .line 347
    invoke-virtual/range {p0 .. p0}, Landroid/graphics/Bitmap;->recycle()V

    .end local v12           #sH:F
    .end local v13           #sW:F
    .end local v14           #srcH:I
    .end local v15           #srcW:I
    :cond_3
    :goto_2
    move-object v3, v10

    .line 351
    goto :goto_0

    .line 306
    .restart local v12       #sH:F
    .restart local v13       #sW:F
    .restart local v14       #srcH:I
    .restart local v15       #srcW:I
    :cond_4
    cmpl-float v3, v13, v12

    if-nez v3, :cond_6

    .line 308
    if-eqz p4, :cond_5

    .line 309
    const/4 v3, 0x0

    :try_start_1
    move-object/from16 v0, p0

    move/from16 v1, p1

    move/from16 v2, p2

    invoke-static {v0, v1, v2, v3}, Landroid/graphics/Bitmap;->createScaledBitmap(Landroid/graphics/Bitmap;IIZ)Landroid/graphics/Bitmap;

    move-result-object v10

    goto :goto_1

    .line 311
    :cond_5
    move-object/from16 v10, p0

    goto :goto_1

    .line 313
    :cond_6
    cmpl-float v3, v13, v12

    if-lez v3, :cond_a

    .line 314
    if-eqz p3, :cond_7

    int-to-float v3, v15

    move/from16 v0, p1

    int-to-float v9, v0

    mul-float/2addr v9, v12

    sub-float/2addr v3, v9

    const/high16 v9, 0x4000

    div-float/2addr v3, v9

    float-to-int v4, v3

    .line 315
    .local v4, offsetX:I
    :goto_3
    const/4 v5, 0x0

    .line 316
    .local v5, offsetY:I
    if-eqz p3, :cond_8

    mul-int/lit8 v3, v4, 0x2

    sub-int v6, v15, v3

    .line 317
    .local v6, w:I
    :goto_4
    move v7, v14

    .line 318
    .local v7, h:I
    if-eqz p4, :cond_9

    .line 319
    new-instance v8, Landroid/graphics/Matrix;

    invoke-direct {v8}, Landroid/graphics/Matrix;-><init>()V

    .line 320
    .local v8, matrix:Landroid/graphics/Matrix;
    const/high16 v3, 0x3f80

    div-float/2addr v3, v12

    const/high16 v9, 0x3f80

    div-float/2addr v9, v12

    invoke-virtual {v8, v3, v9}, Landroid/graphics/Matrix;->postScale(FF)Z

    .line 321
    const/4 v5, 0x0

    .line 322
    const/4 v9, 0x0

    move-object/from16 v3, p0

    .line 321
    invoke-static/range {v3 .. v9}, Landroid/graphics/Bitmap;->createBitmap(Landroid/graphics/Bitmap;IIIILandroid/graphics/Matrix;Z)Landroid/graphics/Bitmap;

    .end local v5           #offsetY:I
    move-result-object v10

    goto :goto_1

    .line 314
    .end local v4           #offsetX:I
    .end local v6           #w:I
    .end local v7           #h:I
    .end local v8           #matrix:Landroid/graphics/Matrix;
    :cond_7
    const/4 v4, 0x0

    goto :goto_3

    .restart local v4       #offsetX:I
    .restart local v5       #offsetY:I
    :cond_8
    move v6, v15

    .line 316
    goto :goto_4

    .line 324
    .restart local v6       #w:I
    .restart local v7       #h:I
    :cond_9
    const/4 v3, 0x0

    move-object/from16 v0, p0

    invoke-static {v0, v4, v3, v6, v7}, Landroid/graphics/Bitmap;->createBitmap(Landroid/graphics/Bitmap;IIII)Landroid/graphics/Bitmap;

    move-result-object v10

    goto :goto_1

    .line 327
    .end local v4           #offsetX:I
    .end local v5           #offsetY:I
    .end local v6           #w:I
    .end local v7           #h:I
    :cond_a
    const/4 v4, 0x0

    .line 328
    .restart local v4       #offsetX:I
    if-eqz p3, :cond_b

    int-to-float v3, v14

    move/from16 v0, p2

    int-to-float v9, v0

    mul-float/2addr v9, v13

    sub-float/2addr v3, v9

    const/high16 v9, 0x4000

    div-float/2addr v3, v9

    float-to-int v5, v3

    .line 329
    .restart local v5       #offsetY:I
    :goto_5
    move v6, v15

    .line 330
    .restart local v6       #w:I
    if-eqz p3, :cond_c

    mul-int/lit8 v3, v5, 0x2

    sub-int v7, v14, v3

    .line 331
    .restart local v7       #h:I
    :goto_6
    if-eqz p4, :cond_d

    .line 332
    new-instance v8, Landroid/graphics/Matrix;

    invoke-direct {v8}, Landroid/graphics/Matrix;-><init>()V

    .line 333
    .restart local v8       #matrix:Landroid/graphics/Matrix;
    const/high16 v3, 0x3f80

    div-float/2addr v3, v13

    const/high16 v9, 0x3f80

    div-float/2addr v9, v13

    invoke-virtual {v8, v3, v9}, Landroid/graphics/Matrix;->postScale(FF)Z

    .line 334
    const/4 v9, 0x0

    move-object/from16 v3, p0

    invoke-static/range {v3 .. v9}, Landroid/graphics/Bitmap;->createBitmap(Landroid/graphics/Bitmap;IIIILandroid/graphics/Matrix;Z)Landroid/graphics/Bitmap;

    move-result-object v10

    goto/16 :goto_1

    .line 328
    .end local v5           #offsetY:I
    .end local v6           #w:I
    .end local v7           #h:I
    .end local v8           #matrix:Landroid/graphics/Matrix;
    :cond_b
    const/4 v5, 0x0

    goto :goto_5

    .restart local v5       #offsetY:I
    .restart local v6       #w:I
    :cond_c
    move v7, v14

    .line 330
    goto :goto_6

    .line 336
    .restart local v7       #h:I
    :cond_d
    move-object/from16 v0, p0

    invoke-static {v0, v4, v5, v6, v7}, Landroid/graphics/Bitmap;->createBitmap(Landroid/graphics/Bitmap;IIII)Landroid/graphics/Bitmap;
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0

    move-result-object v10

    goto/16 :goto_1

    .line 339
    .end local v4           #offsetX:I
    .end local v5           #offsetY:I
    .end local v6           #w:I
    .end local v7           #h:I
    .end local v12           #sH:F
    .end local v13           #sW:F
    .end local v14           #srcH:I
    .end local v15           #srcW:I
    :catch_0
    move-exception v11

    .line 340
    .local v11, e:Ljava/lang/Exception;
    :try_start_2
    const-string v3, "PicUtil"

    const-string v9, "resizePic error!!!"

    invoke-static {v3, v9, v11}, Lcom/netease/util/Logger;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V

    .line 341
    if-eqz v10, :cond_e

    .line 342
    invoke-virtual {v10}, Landroid/graphics/Bitmap;->recycle()V
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_0

    .line 343
    const/4 v10, 0x0

    .line 346
    :cond_e
    if-eqz p0, :cond_3

    if-eqz p0, :cond_3

    .line 347
    invoke-virtual/range {p0 .. p0}, Landroid/graphics/Bitmap;->recycle()V

    goto/16 :goto_2

    .line 345
    .end local v11           #e:Ljava/lang/Exception;
    :catchall_0
    move-exception v3

    .line 346
    if-eqz p0, :cond_f

    move-object/from16 v0, p0

    if-eq v0, v10, :cond_f

    .line 347
    invoke-virtual/range {p0 .. p0}, Landroid/graphics/Bitmap;->recycle()V

    .line 349
    :cond_f
    throw v3
.end method

.method public static saveBitmap(Landroid/graphics/Bitmap;Ljava/lang/String;Ljava/lang/String;ZZ)Landroid/graphics/Bitmap;
    .locals 5
    .parameter "bm"
    .parameter "path"
    .parameter "size"
    .parameter "resized"
    .parameter "scaled"

    .prologue
    .line 202
    if-eqz p0, :cond_1

    .line 204
    new-instance v0, Ljava/io/File;

    invoke-direct {v0, p1}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    .line 205
    .local v0, f:Ljava/io/File;
    invoke-static {v0}, Lcom/netease/util/FileUtils;->createFile(Ljava/io/File;)V

    .line 206
    invoke-virtual {v0}, Ljava/io/File;->exists()Z

    move-result v3

    if-eqz v3, :cond_1

    .line 207
    invoke-static {p2}, Lcom/netease/util/PicUtils;->parseSize(Ljava/lang/String;)[I

    move-result-object v1

    .line 208
    .local v1, s:[I
    if-eqz v1, :cond_0

    .line 209
    const/4 v3, 0x0

    aget v3, v1, v3

    const/4 v4, 0x1

    aget v4, v1, v4

    invoke-static {p0, v3, v4, p3, p4}, Lcom/netease/util/PicUtils;->resizePic(Landroid/graphics/Bitmap;IIZZ)Landroid/graphics/Bitmap;

    move-result-object p0

    .line 211
    :cond_0
    if-eqz p0, :cond_1

    .line 212
    move-object v2, p0

    .line 213
    .local v2, saveBitmap:Landroid/graphics/Bitmap;
    new-instance v3, Ljava/lang/Thread;

    new-instance v4, Lcom/netease/util/PicUtils$1;

    invoke-direct {v4, v0, v2}, Lcom/netease/util/PicUtils$1;-><init>(Ljava/io/File;Landroid/graphics/Bitmap;)V

    invoke-direct {v3, v4}, Ljava/lang/Thread;-><init>(Ljava/lang/Runnable;)V

    .line 234
    invoke-virtual {v3}, Ljava/lang/Thread;->start()V

    .line 242
    .end local v0           #f:Ljava/io/File;
    .end local v1           #s:[I
    .end local v2           #saveBitmap:Landroid/graphics/Bitmap;
    .end local p0
    :goto_0
    return-object p0

    .restart local p0
    :cond_1
    const/4 p0, 0x0

    goto :goto_0
.end method

.method public static saveBitmap(Ljava/io/InputStream;Ljava/lang/String;Ljava/lang/String;ZZ)Ljava/lang/String;
    .locals 4
    .parameter "is"
    .parameter "name"
    .parameter "size"
    .parameter "resized"
    .parameter "scaled"

    .prologue
    const/4 v3, 0x0

    .line 184
    new-instance v1, Lcom/netease/util/PicUtils$FlushedInputStream;

    invoke-direct {v1, p0}, Lcom/netease/util/PicUtils$FlushedInputStream;-><init>(Ljava/io/InputStream;)V

    invoke-static {}, Lcom/netease/util/PicUtils;->getWriteBitmapOptions()Landroid/graphics/BitmapFactory$Options;

    move-result-object v2

    invoke-static {v1, v3, v2}, Landroid/graphics/BitmapFactory;->decodeStream(Ljava/io/InputStream;Landroid/graphics/Rect;Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;

    move-result-object v0

    .line 185
    .local v0, bm:Landroid/graphics/Bitmap;
    if-eqz v0, :cond_0

    .line 186
    invoke-static {v0, p1, p2, p3, p4}, Lcom/netease/util/PicUtils;->saveBitmap(Landroid/graphics/Bitmap;Ljava/lang/String;Ljava/lang/String;ZZ)Landroid/graphics/Bitmap;

    .line 189
    :cond_0
    return-object v3
.end method

.method public static scalePic(Landroid/graphics/Bitmap;F)Landroid/graphics/Bitmap;
    .locals 8
    .parameter "src"
    .parameter "scale"

    .prologue
    .line 252
    const/4 v5, 0x0

    cmpl-float v5, p1, v5

    if-nez v5, :cond_0

    .line 275
    .end local p0
    :goto_0
    return-object p0

    .line 256
    .restart local p0
    :cond_0
    const/4 v0, 0x0

    .line 258
    .local v0, bitmap:Landroid/graphics/Bitmap;
    if-nez p0, :cond_2

    .line 259
    const-string v5, "PicUtil"

    new-instance v6, Ljava/lang/StringBuilder;

    const-string v7, "resizePic error!!! "

    invoke-direct {v6, v7}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v6, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v6

    invoke-static {v5, v6}, Lcom/netease/util/Logger;->e(Ljava/lang/String;Ljava/lang/String;)V

    .line 260
    if-eqz p0, :cond_1

    .line 261
    invoke-virtual {p0}, Landroid/graphics/Bitmap;->recycle()V

    .line 263
    :cond_1
    const/4 p0, 0x0

    goto :goto_0

    .line 265
    :cond_2
    invoke-virtual {p0}, Landroid/graphics/Bitmap;->getWidth()I

    move-result v4

    .line 266
    .local v4, srcW:I
    invoke-virtual {p0}, Landroid/graphics/Bitmap;->getHeight()I

    move-result v3

    .line 267
    .local v3, srcH:I
    int-to-float v5, v4

    div-float/2addr v5, p1

    float-to-int v2, v5

    .line 268
    .local v2, dstW:I
    int-to-float v5, v3

    div-float/2addr v5, p1

    float-to-int v1, v5

    .line 269
    .local v1, dstH:I
    const/4 v5, 0x0

    invoke-static {p0, v2, v1, v5}, Landroid/graphics/Bitmap;->createScaledBitmap(Landroid/graphics/Bitmap;IIZ)Landroid/graphics/Bitmap;

    move-result-object v0

    .line 271
    if-eqz p0, :cond_3

    if-eq p0, v0, :cond_3

    .line 272
    invoke-virtual {p0}, Landroid/graphics/Bitmap;->recycle()V

    :cond_3
    move-object p0, v0

    .line 275
    goto :goto_0
.end method
